refactor(browser): replace workspace with explicit sessions#1461
Merged
Conversation
5428321 to
8d058af
Compare
8d058af to
f613250
Compare
jackwener
pushed a commit
to hansnow/OpenCLI
that referenced
this pull request
May 13, 2026
`pageScopedResult()` in extension/src/background.ts was spreading the
lease's session into the result `data` for every page-scoped command. For
the `exec` action — which routes user JavaScript through page.evaluate()
— this contaminated arbitrary user-JS returns:
* Array / primitive returns came back as `{ session, data: <value> }`
envelopes. Adapters that did `Array.isArray(result)` got `false` and
treated the page as having no rows. Visible repro:
`opencli google search ...` and `opencli xiaohongshu search ...` —
Chrome rendered results correctly but adapters extracted an empty array
(reported in jackwener#1518 from the Browser Bridge v1.0.12 envelope).
* Plain-object returns had an extra `session` key spliced in, silently
overwriting any user `session` field with the lease's value.
Fix in the extension layer instead of compensating client-side:
`pageScopedResult` now returns `{ id, ok, data, page }` — the same form
it had before jackwener#1461 added the workspace→session refactor. Client-side
unwrapping is no longer needed and the original PR jackwener#1518 `Page.evaluate`
heuristic is dropped (it only covered the array path and would have
missed the plain-object path).
Two adapter improvements kept from the original PR:
* `clis/google/search.js` — wait for `#rso a h3` (with a 5s timeout)
before extracting. On Chrome 148 / Linux Wayland the DOM can settle
before SERP anchors are populated, so the existing fixed `wait 2`
could return empty even with the envelope fix.
* `clis/xiaohongshu/search.js` — extract initially visible cards before
scrolling, then merge post-scroll rows by URL. Xiaohongshu's
virtualized masonry can evict the initial note cards from the DOM
after scroll, causing extraction to return [] even though the
browser had rendered results correctly.
Extension version bumped to 1.0.14.
Repro environment (from jackwener#1518):
* OpenCLI 1.7.18
* Browser Bridge extension 1.0.12 → 1.0.14
* Chrome 148.0.7778.96
* Linux Wayland, Node 22.22.1
Tests: extension/src/background.test.ts navigate same-url assertion
updated to no longer expect `session` in `data`. Three Page.evaluate
unwrap test cases removed.
jackwener
pushed a commit
that referenced
this pull request
May 13, 2026
`pageScopedResult()` in extension/src/background.ts was spreading the
lease's session into the result `data` for every page-scoped command. For
the `exec` action — which routes user JavaScript through page.evaluate()
— this contaminated arbitrary user-JS returns:
* Array / primitive returns came back as `{ session, data: <value> }`
envelopes. Adapters that did `Array.isArray(result)` got `false` and
treated the page as having no rows. Visible repro:
`opencli google search ...` and `opencli xiaohongshu search ...` —
Chrome rendered results correctly but adapters extracted an empty array
(reported in #1518 from the Browser Bridge v1.0.12 envelope).
* Plain-object returns had an extra `session` key spliced in, silently
overwriting any user `session` field with the lease's value.
Fix in the extension layer instead of compensating client-side:
`pageScopedResult` now returns `{ id, ok, data, page }` — the same form
it had before #1461 added the workspace→session refactor. Client-side
unwrapping is no longer needed and the original PR #1518 `Page.evaluate`
heuristic is dropped (it only covered the array path and would have
missed the plain-object path).
Two adapter improvements kept from the original PR:
* `clis/google/search.js` — wait for `#rso a h3` (with a 5s timeout)
before extracting. On Chrome 148 / Linux Wayland the DOM can settle
before SERP anchors are populated, so the existing fixed `wait 2`
could return empty even with the envelope fix.
* `clis/xiaohongshu/search.js` — extract initially visible cards before
scrolling, then merge post-scroll rows by URL. Xiaohongshu's
virtualized masonry can evict the initial note cards from the DOM
after scroll, causing extraction to return [] even though the
browser had rendered results correctly.
Extension version bumped to 1.0.14.
Repro environment (from #1518):
* OpenCLI 1.7.18
* Browser Bridge extension 1.0.12 → 1.0.14
* Chrome 148.0.7778.96
* Linux Wayland, Node 22.22.1
Tests: extension/src/background.test.ts navigate same-url assertion
updated to no longer expect `session` in `data`. Three Page.evaluate
unwrap test cases removed.
4 tasks
jackwener
added a commit
that referenced
this pull request
May 13, 2026
Per-PR e2e-headed Chrome was the dominant PR-time wait (~10-15 min on two platforms) and on fork PRs blocks behind maintainer approval, while the actually-blocking failures it caught in the last 30 days were all e2e-test migrations missed by the authoring PR (#1461 / #1505 workspace ->session) rather than real regressions the unit/typecheck tier missed. PR feedback path is now: - typecheck / unit / lint / adapter / build ← `pull_request` (ci.yml) - extension typecheck / build ← `pull_request` (build-extension.yml) - docs build ← `pull_request` (doc-check.yml) - security audit ← `pull_request` (security.yml) E2E-headed Chrome guards: - push to main / dev (watched paths) - push v* tag (release) - nightly cron 08:00 UTC (added: catches Chrome version drift / flake drift even when no commits touch watched paths) - workflow_dispatch (manual when a PR really wants e2e signal) smoke-test was already gated on `schedule || workflow_dispatch` only (ci.yml), so no change needed there.
This was referenced May 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--workspacemodel with required--session <name>onopencli browser *--domain,--path-prefix,--allow-navigate-bound) and remove browser namespace--keep-tabsession,surface,kind, with browser result/session docs updatedbrowserSession.reuse: 'site'behavior unchanged; only the browser user surface changes hereVerification
npx tsc --noEmitnpm test -- --run clis/notebooklm/*.test.js src/cli.test.ts src/browser/page.test.ts src/browser/daemon-client.test.ts src/browser/network-cache.test.ts src/doctor.test.ts src/execution.test.ts src/observation/manager.test.ts src/observation/artifact.test.tsnpx vitest run --project extension extension/src/background.test.tsnpm run buildnpm run typecheck && npm run buildinextension/npm run docs:buildnpm run check:typed-error-lintnpm run check:silent-column-dropgit diff --checkNotes
Breaking by design: no backward compatibility for
--workspace/bound:browser surface. Adapter site-continuity rename tositeSession: 'persistent'is a follow-up PR.